<template>
  <div class="login">
    <div class="login-header">
      <router-link tag="span" to="/login" class="cha">👈</router-link>
      <span>帮助</span>
    </div>
    <div class="login-content">
      <div class="des">
        <h2>手机号密码登录</h2>
      </div>
      <div class="login-box">
        <div class="sele">
          <select class="sele-control">
            <option value="">+86</option>
          </select>
        </div>
        <div class="inp">
          <input
            type="text"
            class="inp-control"
            placeholder="请输入手机号"
            v-model="tel"
            @input="telChange"
          />
        </div>
      </div>
      <div class="login-box">
        <div class="inp">
          <input
            type="password"
            class="inp-control"
            placeholder="请输入密码"
            v-model="password"
            @input="telChange"
          />
        </div>
      </div>
      <span class="agree"
        >登录即表明同意<a href="">抖音协议</a>和<a href="">隐私政策</a></span
      >
      <div class="login-btn">
        <button :disabled="disabled" 
        :class="disabled ? '' : 'active'">登录</button>
      </div>
      <div class="other">
        <span>忘记了？<a href="">找回密码</a></span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name:'TpLogin',
  data(){
    return{
      tel:'',
      password:'',
      disabled:true
    }
  },
  methods:{
    telChange(){
      var judge = /^1[345789]{1}\d{9}$/;
      console.log(this.password);
      if(judge.test(this.tel)&&(this.password.length>=6)){
        // 登录判断
        this.disabled=false
      }else{
        this.disabled=true
      }
    }
  }
}
</script>
<style scoped>
.login {
  position: relative;
  float: left;
  padding: 30px;
  height: 667px;
  width: 100%;
}
.login-header {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  line-height: 30px;
}
.login-header .cha {
  font-size: 23px;
}
.login-header .icon {
  font-size: 20px;
}
.login-content {
  padding: 40px 10px;
  height: 100%;
}
.des h2 {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 20px;
}
.agree {
  color: #666;
  line-height: 50px;
  font-size: 13px;
  opacity: 0.7;
}
.agree a {
  color: #0359a0;
}
.login-box {
  display: flex;
  height: 44px;
  align-items: center;
  background-color: #f9f9f9;
  margin-top: 10px;
}
.sele-control {
  background-color: #f9f9f9;
  height: 36px;
  border: none;
  font-size: 15px;
}
.inp-control {
  height: 40px;
  background-color: #f9f9f9;
  border: none;
  width: 90%;
  margin-left: 10px;
  outline: none;
  font-size: 15px;
}
input {
  caret-color: #fe2c55;
}
input::-webkit-input-placeholder {
  color: #cccccc;
}
.code-btn button {
  background-color: #ccc;
  margin: 20px 0;
  width: 100%;
  padding: 12px 0;
  border: none;
  color: #fdfdfd;
}
.login-btn button {
  background-color: #ccc;
  width: 100%;
  border: none;
  color: #fdfdfd;
  padding: 10px 0;
  margin-bottom: 8px;
}
.login-btn .active {
  background-color: #fe2c55;
}
.other {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.other a {
  color: #106ab4;
}
a {
  text-decoration: none;
}
</style>
